Skip to content

test: run unittests in parallel#8780

Merged
jsha merged 3 commits into
mainfrom
faster-unit-tests
Jun 5, 2026
Merged

test: run unittests in parallel#8780
jsha merged 3 commits into
mainfrom
faster-unit-tests

Conversation

@jsha
Copy link
Copy Markdown
Contributor

@jsha jsha commented Jun 4, 2026

We have been using go test -p=1 to avoid conflicts between unittests in different packages that both modify the database. However, this significantly slows down running tests.

Since it's really on the the sa and ra packages that conflict, and some logic to just handle those.

Also, the race detector sleeps for 1s before a process exits. Since each package's test are run as a single process, this costs us a second per package. Lower that to 50ms.

In CI, this takes us from 7m25s for the unittest job to 4m19s.

We have been using `go test -p=1` to avoid conflicts between unittests in
different packages that both modify the database. However, this significantly
slows down running tests.

Since it's really on the the sa and ra packages that conflict, and some logic to
just handle those.

On my machine, this takes us from 56s to 20s (no race detection).

When race detection is enabled, the difference is even more dramatic, because
each package's test runner sleeps for a second before exiting. On my machine,
70s becomes 30s.
@jsha jsha force-pushed the faster-unit-tests branch from a5074d9 to b5cbb50 Compare June 4, 2026 23:27
@jsha jsha marked this pull request as ready for review June 4, 2026 23:52
@jsha jsha requested a review from a team as a code owner June 4, 2026 23:52
@jsha jsha requested a review from ezekiel June 4, 2026 23:52
@jsha
Copy link
Copy Markdown
Contributor Author

jsha commented Jun 5, 2026

Test-only, merging on one review.

@jsha jsha merged commit 1d0606e into main Jun 5, 2026
18 checks passed
@jsha jsha deleted the faster-unit-tests branch June 5, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants